package com.taikang.hmp.hbusiness.diabetes.measure.sugar.service;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Set;

import com.taikang.hmp.frame.common.datastructre.support.ConcurrentHashSet;
import com.taikang.hmp.hbusiness.diabetes.measure.sugar.bean.SugarMonitor;
import com.taikang.hmp.hbusiness.diabetes.measure.sugar.bean.SugarPlan;

/** 
 * 血糖
 * author:qrp
 * time:2015年8月2日 下午3:05:59
 */
public class SugarUtil {
	
	private static Set<SugarMonitor> SELECT_SUGAR_MONITOR_PLAN_SET = new ConcurrentHashSet<SugarMonitor>();
	
	static{
		initSugarMonitorPlan();
	}
	
	//初始化血糖监测方案
	private static void initSugarMonitorPlan(){
		if(!SELECT_SUGAR_MONITOR_PLAN_SET.isEmpty()){
			return;
		}
		//
		SugarMonitor sugarMonitor = new SugarMonitor();
		sugarMonitor.setIs_insulin(1);
		sugarMonitor.setPlanNo(1);
		sugarMonitor.setTime(3);
		SugarPlan sugarPlan = new SugarPlan();
		sugarPlan.setBreakfast_pre("1");
		sugarPlan.setBreakfast_aft("1");
		sugarPlan.setLunch_pre("0");
		sugarPlan.setLunch_aft("1");
		sugarPlan.setDinner_pre("0");
		sugarPlan.setDinner_aft("1");
		sugarPlan.setSleep_pre("1");
		sugarMonitor.setSugarPlan(sugarPlan);
		SELECT_SUGAR_MONITOR_PLAN_SET.add(sugarMonitor);
		//
		SugarMonitor sugarMonitor1 = new SugarMonitor();
		sugarMonitor1.setIs_insulin(1);
		sugarMonitor1.setPlanNo(1);
		sugarMonitor1.setTime(4);
		SugarPlan sugarPlan1 = new SugarPlan();
		sugarPlan1.setBreakfast_pre("1");
		sugarPlan1.setBreakfast_aft("1");
		sugarPlan1.setLunch_pre("0");
		sugarPlan1.setLunch_aft("1");
		sugarPlan1.setDinner_pre("0");
		sugarPlan1.setDinner_aft("1");
		sugarPlan1.setSleep_pre("1");
		sugarMonitor1.setSugarPlan(sugarPlan1);
		SELECT_SUGAR_MONITOR_PLAN_SET.add(sugarMonitor1);
		//
		SugarMonitor sugarMonitor2 = new SugarMonitor();
		sugarMonitor2.setIs_insulin(1);
		sugarMonitor2.setPlanNo(1);
		sugarMonitor2.setTime(5);
		SugarPlan sugarPlan2 = new SugarPlan();
		sugarPlan2.setBreakfast_pre("1");
		sugarPlan2.setBreakfast_aft("1");
		sugarPlan2.setLunch_pre("0");
		sugarPlan2.setLunch_aft("1");
		sugarPlan2.setDinner_pre("0");
		sugarPlan2.setDinner_aft("1");
		sugarPlan2.setSleep_pre("1");
		sugarMonitor2.setSugarPlan(sugarPlan2);
		SELECT_SUGAR_MONITOR_PLAN_SET.add(sugarMonitor2);
		//
		SugarMonitor sugarMonitor3 = new SugarMonitor();
		sugarMonitor3.setIs_insulin(1);
		sugarMonitor3.setPlanNo(2);
		sugarMonitor3.setTime(1);
		SugarPlan sugarPlan3 = new SugarPlan();
		sugarPlan3.setBreakfast_pre("1");
		sugarPlan3.setBreakfast_aft("1");
		sugarPlan3.setLunch_pre("0");
		sugarPlan3.setLunch_aft("0");
		sugarPlan3.setDinner_pre("0");
		sugarPlan3.setDinner_aft("0");
		sugarPlan3.setSleep_pre("0");
		sugarMonitor3.setSugarPlan(sugarPlan3);
		SELECT_SUGAR_MONITOR_PLAN_SET.add(sugarMonitor3);
		//
		SugarMonitor sugarMonitor4 = new SugarMonitor();
		sugarMonitor4.setIs_insulin(1);
		sugarMonitor4.setPlanNo(2);
		sugarMonitor4.setTime(3);
		SugarPlan sugarPlan4 = new SugarPlan();
		sugarPlan4.setBreakfast_pre("0");
		sugarPlan4.setBreakfast_aft("0");
		sugarPlan4.setLunch_pre("1");
		sugarPlan4.setLunch_aft("1");
		sugarPlan4.setDinner_pre("0");
		sugarPlan4.setDinner_aft("0");
		sugarPlan4.setSleep_pre("0");
		sugarMonitor4.setSugarPlan(sugarPlan4);
		SELECT_SUGAR_MONITOR_PLAN_SET.add(sugarMonitor4);
		//
		SugarMonitor sugarMonitor5 = new SugarMonitor();
		sugarMonitor5.setIs_insulin(1);
		sugarMonitor5.setPlanNo(2);
		sugarMonitor5.setTime(6);
		SugarPlan sugarPlan5 = new SugarPlan();
		sugarPlan5.setBreakfast_pre("0");
		sugarPlan5.setBreakfast_aft("0");
		sugarPlan5.setLunch_pre("0");
		sugarPlan5.setLunch_aft("0");
		sugarPlan5.setDinner_pre("1");
		sugarPlan5.setDinner_aft("1");
		sugarPlan5.setSleep_pre("0");
		sugarMonitor5.setSugarPlan(sugarPlan5);
		SELECT_SUGAR_MONITOR_PLAN_SET.add(sugarMonitor5);
		//
		SugarMonitor sugarMonitor6 = new SugarMonitor();
		sugarMonitor6.setIs_insulin(1);
		sugarMonitor6.setPlanNo(3);
		sugarMonitor6.setTime(3);
		SugarPlan sugarPlan6 = new SugarPlan();
		sugarPlan6.setBreakfast_pre("1");
		sugarPlan6.setBreakfast_aft("0");
		sugarPlan6.setLunch_pre("0");
		sugarPlan6.setLunch_aft("0");
		sugarPlan6.setDinner_pre("0");
		sugarPlan6.setDinner_aft("1");
		sugarPlan6.setSleep_pre("0");
		sugarMonitor6.setSugarPlan(sugarPlan6);
		SELECT_SUGAR_MONITOR_PLAN_SET.add(sugarMonitor6);
		//胰岛素治疗 方案1
		SugarMonitor sugarMonitor7 = new SugarMonitor();
		sugarMonitor7.setIs_insulin(0);
		sugarMonitor7.setPlanNo(1);
		sugarMonitor7.setTime(7);
		SugarPlan sugarPlan7 = new SugarPlan();
		sugarPlan7.setBreakfast_pre("1");
		sugarPlan7.setBreakfast_aft("1");
		sugarPlan7.setLunch_pre("0");
		sugarPlan7.setLunch_aft("1");
		sugarPlan7.setDinner_pre("0");
		sugarPlan7.setDinner_aft("1");
		sugarPlan7.setSleep_pre("1");
		sugarMonitor7.setSugarPlan(sugarPlan7);
		SELECT_SUGAR_MONITOR_PLAN_SET.add(sugarMonitor7);
		//胰岛素治疗 方案2
		SugarMonitor sugarMonitor8 = new SugarMonitor();
		sugarMonitor8.setIs_insulin(0);
		sugarMonitor8.setPlanNo(2);
		sugarMonitor8.setTime(14);
		SugarPlan sugarPlan8 = new SugarPlan();
		sugarPlan8.setBreakfast_pre("1");
		sugarPlan8.setBreakfast_aft("1");
		sugarPlan8.setLunch_pre("0");
		sugarPlan8.setLunch_aft("1");
		sugarPlan8.setDinner_pre("0");
		sugarPlan8.setDinner_aft("1");
		sugarPlan8.setSleep_pre("1");
		sugarMonitor8.setSugarPlan(sugarPlan8);
		SELECT_SUGAR_MONITOR_PLAN_SET.add(sugarMonitor8);
		//胰岛素治疗 方案3
		SugarMonitor sugarMonitor9 = new SugarMonitor();
		sugarMonitor9.setIs_insulin(0);
		sugarMonitor9.setPlanNo(3);
		sugarMonitor9.setTime(1);
		SugarPlan sugarPlan9 = new SugarPlan();
		sugarPlan9.setBreakfast_pre("1");
		sugarPlan9.setBreakfast_aft("0");
		sugarPlan9.setLunch_pre("0");
		sugarPlan9.setLunch_aft("0");
		sugarPlan9.setDinner_pre("0");
		sugarPlan9.setDinner_aft("0");
		sugarPlan9.setSleep_pre("0");
		sugarMonitor9.setSugarPlan(sugarPlan9);
		SELECT_SUGAR_MONITOR_PLAN_SET.add(sugarMonitor9);
		//胰岛素治疗 方案3
		SugarMonitor sugarMonitor10 = new SugarMonitor();
		sugarMonitor10.setIs_insulin(0);
		sugarMonitor10.setPlanNo(3);
		sugarMonitor10.setTime(3);
		SugarPlan sugarPlan10 = new SugarPlan();
		sugarPlan10.setBreakfast_pre("1");
		sugarPlan10.setBreakfast_aft("0");
		sugarPlan10.setLunch_pre("0");
		sugarPlan10.setLunch_aft("0");
		sugarPlan10.setDinner_pre("0");
		sugarPlan10.setDinner_aft("0");
		sugarPlan10.setSleep_pre("0");
		sugarMonitor10.setSugarPlan(sugarPlan10);
		SELECT_SUGAR_MONITOR_PLAN_SET.add(sugarMonitor10);
		//胰岛素治疗 方案3
		SugarMonitor sugarMonitor11 = new SugarMonitor();
		sugarMonitor11.setIs_insulin(0);
		sugarMonitor11.setPlanNo(3);
		sugarMonitor11.setTime(6);
		SugarPlan sugarPlan11 = new SugarPlan();
		sugarPlan11.setBreakfast_pre("1");
		sugarPlan11.setBreakfast_aft("0");
		sugarPlan11.setLunch_pre("0");
		sugarPlan11.setLunch_aft("0");
		sugarPlan11.setDinner_pre("0");
		sugarPlan11.setDinner_aft("0");
		sugarPlan11.setSleep_pre("0");
		sugarMonitor11.setSugarPlan(sugarPlan11);
		SELECT_SUGAR_MONITOR_PLAN_SET.add(sugarMonitor11);
		//胰岛素治疗 方案4
		SugarMonitor sugarMonitor12 = new SugarMonitor();
		sugarMonitor12.setIs_insulin(0);
		sugarMonitor12.setPlanNo(4);
		sugarMonitor12.setTime(1);
		SugarPlan sugarPlan12 = new SugarPlan();
		sugarPlan12.setBreakfast_pre("1");
		sugarPlan12.setBreakfast_aft("0");
		sugarPlan12.setLunch_pre("0");
		sugarPlan12.setLunch_aft("0");
		sugarPlan12.setDinner_pre("1");
		sugarPlan12.setDinner_aft("0");
		sugarPlan12.setSleep_pre("0");
		sugarMonitor12.setSugarPlan(sugarPlan12);
		SELECT_SUGAR_MONITOR_PLAN_SET.add(sugarMonitor12);
		////胰岛素治疗 方案4
		SugarMonitor sugarMonitor13 = new SugarMonitor();
		sugarMonitor13.setIs_insulin(0);
		sugarMonitor13.setPlanNo(4);
		sugarMonitor13.setTime(3);
		SugarPlan sugarPlan13 = new SugarPlan();
		sugarPlan13.setBreakfast_pre("1");
		sugarPlan13.setBreakfast_aft("0");
		sugarPlan13.setLunch_pre("0");
		sugarPlan13.setLunch_aft("0");
		sugarPlan13.setDinner_pre("1");
		sugarPlan13.setDinner_aft("0");
		sugarPlan13.setSleep_pre("0");
		sugarMonitor13.setSugarPlan(sugarPlan13);
		SELECT_SUGAR_MONITOR_PLAN_SET.add(sugarMonitor13);
		//胰岛素治疗 方案4
		SugarMonitor sugarMonitor14 = new SugarMonitor();
		sugarMonitor14.setIs_insulin(0);
		sugarMonitor14.setPlanNo(4);
		sugarMonitor14.setTime(6);
		SugarPlan sugarPlan14 = new SugarPlan();
		sugarPlan14.setBreakfast_pre("1");
		sugarPlan14.setBreakfast_aft("0");
		sugarPlan14.setLunch_pre("0");
		sugarPlan14.setLunch_aft("0");
		sugarPlan14.setDinner_pre("1");
		sugarPlan14.setDinner_aft("0");
		sugarPlan14.setSleep_pre("0");
		sugarMonitor14.setSugarPlan(sugarPlan14);
		SELECT_SUGAR_MONITOR_PLAN_SET.add(sugarMonitor14);
		//胰岛素治疗 方案5
		SugarMonitor sugarMonitor15 = new SugarMonitor();
		sugarMonitor15.setIs_insulin(0);
		sugarMonitor15.setPlanNo(5);
		sugarMonitor15.setTime(3);
		SugarPlan sugarPlan15 = new SugarPlan();
		sugarPlan15.setBreakfast_pre("1");
		sugarPlan15.setBreakfast_aft("1");
		sugarPlan15.setLunch_pre("0");
		sugarPlan15.setLunch_aft("0");
		sugarPlan15.setDinner_pre("0");
		sugarPlan15.setDinner_aft("1");
		sugarPlan15.setSleep_pre("0");
		sugarMonitor15.setSugarPlan(sugarPlan15);
		SELECT_SUGAR_MONITOR_PLAN_SET.add(sugarMonitor15);
		//胰岛素治疗 方案6
		SugarMonitor sugarMonitor16 = new SugarMonitor();
		sugarMonitor16.setIs_insulin(0);
		sugarMonitor16.setPlanNo(6);
		sugarMonitor16.setTime(3);
		SugarPlan sugarPlan16 = new SugarPlan();
		sugarPlan16.setBreakfast_pre("1");
		sugarPlan16.setBreakfast_aft("0");
		sugarPlan16.setLunch_pre("0");
		sugarPlan16.setLunch_aft("0");
		sugarPlan16.setDinner_pre("1");
		sugarPlan16.setDinner_aft("1");
		sugarPlan16.setSleep_pre("0");
		sugarMonitor16.setSugarPlan(sugarPlan16);
		SELECT_SUGAR_MONITOR_PLAN_SET.add(sugarMonitor16);
		//
	}
	
	
	
	
	/**
	 * 通过日期获取周几
	 * @param date
	 * @return
	 */
	public static int getWeekOfDate(Date date) {
		Calendar calendar = Calendar.getInstance();
		if (date != null) {
			calendar.setTime(date);
		}
		int w = calendar.get(Calendar.DAY_OF_WEEK) - 1;
		if (w < 0) {
			w = 7;
		}
		return w;
	}

	/**
	 * 得到几天前的时间
	 * 
	 * @param d
	 * @param day
	 * @return
	 */
	public static Date getDateBefore(Date d, int day) {
		Calendar now = Calendar.getInstance();
		now.setTime(d);
		now.set(Calendar.DATE, now.get(Calendar.DATE) - day);
		return now.getTime();
	}

	/**
	 * 得到几天后的时间
	 * 
	 * @param d
	 * @param day
	 * @return
	 */
	public static Date getDateAfter(Date d, int day) {
		Calendar now = Calendar.getInstance();
		now.setTime(d);
		now.set(Calendar.DATE, now.get(Calendar.DATE) + day);
		return now.getTime();
	}
	
	/**
	 * 判断血糖范围，给出评价结果
	 * @param parm1 血糖测量值 ;单位 mmol/L
	 * @param parm2 时间段
	 * @return 0：血糖过低;1：血糖低了;2:血糖偏低;3:血糖正常;4:血糖偏高;5:血糖高了;6:血糖过高;
	 */
	public static String getSugarVaule(float parm1 ,String parm2){
		String result = "";
		if(parm1 <= 2.8001){
			result = "0";
		}else if(parm1 >=2.8001 && parm1 <= 3.9001){
			result = "1";
		}else if(parm1 >3.9001 && parm1 <= 4.3001){
			result = "2";
		}else if(parm1 >=13.9001 && parm1 <= 16.6001){
			result = "5";
		}else if(parm1 >= 16.6001){
			result = "6";
		}else if((parm1 >= 4.3001 && parm1 <= 7.0001 && parm2.equals("0")) || (parm1>4.3001 && parm1 < 10.0001 && parm2.equals("1"))){
			result = "3";
		}else if((parm1 >=7.0001 && parm1 <= 13.9001 && parm2.equals("0")) || (parm1 >=10.0001 && parm1 <= 13.9001 && parm2.equals("1"))){
			result = "4";
		}
		return result;
	}
	/**
	 * 判断是餐前还是餐后
	 * @param parm
	 * @return 0:餐前；1:餐后
	 */
	public static int getB_A(String parm){
		String[] canqian = {"0", "2", "4"};
		if(Arrays.asList(canqian).contains(parm)){
			return 0;
		}else{
			return 1;
		}
	}

	/**
	 * 取得餐前 4.4~7.0的次数 ≥80% ,餐后4.4~10.0次数 ≥80%
	 * @param param1 餐前测量列表
	 * @param param2 餐后测量列表
	 * @param bplancount 餐前计划测量次数
	 * @param aplancount 餐后计划测量次数
	 * @return 0:不满足；1：满足
	 */
	public static int getResult1(List<String> param1,List<String> param2,int bplancount,int aplancount){
		int result = 0;
		int count1 = 0;
		for(int i=0;i<param1.size();i++){
			if(Float.parseFloat(param1.get(i)) <= 7.0 && Float.parseFloat(param1.get(i)) >= 4.4){
				count1++;
			}
		}
		float avg1 = 0;
		if(bplancount > 0){
			avg1 = count1/Float.parseFloat(String.valueOf(bplancount));
		}else {
			//avg1 = 1;
		}
		int count2 = 0;
		for(int j=0;j<param2.size();j++){
			if(Float.parseFloat(param2.get(j)) >= 4.4 && Float.parseFloat(param2.get(j)) <= 10.0){
				count2++;
			}
		}
		float avg2 = 0;
		if(aplancount > 0){
			avg2 = count2/Float.parseFloat(String.valueOf(aplancount));
		}else {
			//avg2=1;
		}
		
		if(avg1 >= 0.8 && avg2 >= 0.8 ){
			result = 1;
		}
		return result;
	}
	/**
	 * 取得任意血糖值方案
	 * @param param
	 * @return 0:不满足;1：出现≤3.9的值；2：出现≥16.7的值；3：无任何血糖记录值
	 */
	public static int getResult(List<String> param) {
		int result = 0;
		if(param.size() == 0){
			result = 3;
			
		}
		for (int i = 0; i < param.size(); i++) {
			if(Float.parseFloat(param.get(i)) <= 3.91){
				result = 1;
			}else if(Float.parseFloat(param.get(i)) >= 16.69){
				result = 2;
			}
		}
		return result;
	}
	
	
	/**
	 * 获取方案
	 */
	public static List<SugarMonitor> convertToSugarPlans(String sugarPlanCode){
		List<SugarMonitor> result = new ArrayList<SugarMonitor>();
		if(sugarPlanCode != null && !sugarPlanCode.equals("")){
			String[] temps = sugarPlanCode.split("#");
			for(SugarMonitor sugarMonitor : SELECT_SUGAR_MONITOR_PLAN_SET){
				if(sugarMonitor.getIs_insulin() == Integer.parseInt(temps[0]) && sugarMonitor.getPlanNo() == Integer.parseInt(temps[1])){
					SugarMonitor temp = new SugarMonitor();
					temp.setIs_insulin(Integer.parseInt(temps[0]));
					temp.setPlanNo(Integer.parseInt(temps[1]));
					temp.setSugarPlan(sugarMonitor.getSugarPlan());
					temp.setTime(sugarMonitor.getTime());
					result.add(temp);
				}
			}
		}
		return result;
	}
	
	
	/**
	 * 取得初始血糖计划
	 * @param param1 糖化血红蛋白
	 * @param param2 空腹血糖
	 * @param param3 餐后2小时血糖
	 * @param param4 用药情况
	 * @return 监测方案 (0#0,第一位分0、1代表是否胰岛素,第二位代表位各自方案)
	 */
	public static String designInitSugarPlan(float param1,float param2,float param3,String param4){
		String result = "";
		if(param1 < 7 && param4.equals("0") && param1>0.1  ){
			result = "1#3";
		}else if(param1 < 7 && param4.equals("1") && param1>0.1 ){
			result = "0#5";
		}else if(param1 < 7 && param4.equals("2") && param1>0.1  ){
			result = "0#6";
		}else if(param1 >= 7 && param1 < 10 && param4.equals("0") ){
			result = "1#2";
		}else if(param1 >= 7 && param1 < 10 && param4.equals("1") ){
			result = "0#3";
		}else if(param1 >= 7 && param1 < 10 && param4.equals("2") ){
			result = "0#4";
		}else if(param1 >= 10 && param4.equals("0") ){
			result = "1#1";
		}else if(param1 >= 10 && param4.equals("1") ){
			result = "0#1";
		}else if(param1 >= 10 && param4.equals("2") ){
			result = "0#1";
		}else if(param1 <0.1 && param2 > 4.4 && param2 < 7.0 && param3 > 4.4 && param3 < 10.0 && param4.equals("0")){
			result = "1#3";
		}else if(param1<0.1 && param2 > 4.4 && param2 < 7.0 && param3 > 4.4 && param3 < 10.0 && param4.equals("1")){
			result = "0#5";
		}else if(param1 <0.1 && param2 > 4.4 && param2 < 7.0 && param3 > 4.4 && param3 < 10.0 && param4.equals("2")){
			result = "0#6";
		}else if(param1 <0.1 && (param2 <0.1 ||(param2 >= 7.0 && param2 < 16.7)) && param3 > 4.4 && param3 <10.0 && param4.equals("0")){
			result = "1#2";
		}else if(param1 <0.1 && (param2 <0.1 ||(param2 >= 7.0 && param2 < 16.7)) && param3 > 4.4 && param3 <10.0 && param4.equals("1")){
			result = "0#3";
		}else if(param1 <0.1 && (param2 <0.1 ||(param2 >= 7.0 && param2 < 16.7)) && param3 > 4.4 && param3 <10.0 && param4.equals("2")){
			result = "0#4";
		}else if(param1 <0.1 && param2 > 4.4 && param2 < 7.0 && (param3 <0.1 || (param3 >= 10.0 && param3 < 16.7)) && param4.equals("0")){
			result = "1#2";
		}else if(param1 <0.1 && param2 > 4.4 && param2 < 7.0 && (param3 <0.1 || (param3 >= 10.0 && param3 < 16.7)) && param4.equals("1")){
			result = "0#3";
		}else if(param1 <0.1 && param2 > 4.4 && param2 < 7.0 && (param3 <0.1 || (param3 >= 10.0 && param3 < 16.7)) && param4.equals("2")){
			result = "0#4";
		}else if(param1 <0.1 && param2 <0.1 && param3 <0.1  && param4.equals("0")){
			result = "1#2";
		}else if(param1 <0.1 && param2 <0.1 && param3 <0.1  && param4.equals("1")){
			result = "0#3";
		}else if(param1 <0.1 && param2 <0.1 && param3 <0.1  && param4.equals("2")){
			result = "0#4";
		}else if(param1 <0.1 && param2 <= 3.9 && param2 > 0  && param4.equals("0")){
			result = "1#1";
		}else if(param1 <0.1 && param2 <= 3.9 && param2 > 0  && param4.equals("1")){
			result = "0#1";
		}else if(param1 <0.1 && param2 <= 3.9 && param2 > 0  && param4.equals("2")){
			result = "0#1";
		}else if(param1 <0.1  && param3 >= 16.7 && param3 > 0  && param4.equals("0")){
			result = "1#1";
		}else if(param1 <0.1 && param3 >= 16.7 && param3 > 0  && param4.equals("1")){
			result = "0#1";
		}else if(param1 <0.1 && param3 >= 16.7 && param3 > 0  && param4.equals("2")){
			result = "0#1";
		}
		return result;
	}
	
	
	/**
	 * 转化血糖类型
	 * 将所获得的药物类型转换成0-2（非用药/口服药；胰岛素（非预混型）；胰岛素（预混型）2）的形式
	 * @param param
	 * @return 0-2
	 */
	public static String convertMedcineType(String param){
		String result = "";
		if(param.equals("胰岛素（非预混型）") || param.equals("胰岛素(基础型)")){
			result = "1";
		}else if(param.equals("胰岛素（预混型）")){
			result = "2";
		}else{
			result = "0";
		}
		return result;
	}

}
